Skip to content

fix(mcp): correct /api/me/* paths, claim host, env var, surface agent_action#6

Merged
mastermanas805 merged 2 commits into
masterfrom
fix/api-paths-claim-host-envvar
May 14, 2026
Merged

fix(mcp): correct /api/me/* paths, claim host, env var, surface agent_action#6
mastermanas805 merged 2 commits into
masterfrom
fix/api-paths-claim-host-envvar

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

Wave FIX-E findings against the MCP server. The MCP shipped four tools wired to /api/me/* paths that the router never registered — every call returned a generic "instanode.dev error (404)" and the LLM had no path forward. This PR rewires those tools to the canonical routes, plus three smaller contract drifts.

  • #C5 / #107 — 4 of 17 MCP tools called dead /api/me/* paths. Rewired:
    • /api/me/resourcesGET /api/v1/resources
    • /api/me/claimPOST /claim (now takes jwt + email)
    • /api/me/resources/{token}DELETE /api/v1/resources/{token}
    • /api/me/tokenPOST /api/v1/auth/api-keys
  • #C6 / #108claim_resource built https://instanode.dev/start?t=<jwt>. /start is a route on the API host, not the dashboard. Now api.instanode.dev/start?t=<jwt>.
  • #C7 / #109 — MCP discarded agent_action from API error envelopes. formatError now appends Action / Upgrade / Claim lines below the headline so the LLM reads the platform's canonical CTA verbatim instead of guessing from a generic "API error 402". client.ApiError carries new agentAction + claimURL fields.
  • #C8 / #110server.json + smithery.yaml declared INSTANODE_API_BASE while client.ts always read INSTANODE_API_URL. The registry-side name never took effect. Standardized on INSTANODE_API_URL.
  • #C4 / #26 / #106 — Bumped 0.9.0 → 0.9.1. The previous 0.9.0 publish to npm failed and npx instanode-mcp@latest 404'd; this version closes both once the npm publish step runs (see below).

npm publish — MANUAL STEP REQUIRED

The PR producer did not have NPM_TOKEN available in the env. After merge, run from a machine logged in as instanode:

npm whoami        # should print: instanode
npm run build
npm publish --access public
npm view instanode-mcp version  # should print 0.9.1

See PUBLISHING.md for the full registry-chain (MCP registry, Smithery, mcp.so, Cursor).

Cross-references

  • api: fix(api): OpenAPI contract corrections — servers URL, resource_type/status/tier enums, provisioning envelope — same wave.
  • sdk-go: fix(sdk-go): correct DefaultBaseURL + add Deploy() method — same wave.

Test plan

  • npm run build → clean
  • test.sh extended with two new gates (claim host == API host; old claim_token shape rejected)
  • Run bash test.sh against the local k8s cluster
  • npm publish from a machine with credentials, then npx instanode-mcp@0.9.1 smoke test
  • Re-run a smoke claim_resource via Claude Code to confirm the agent_action surfaces

Generated with Claude Code

mastermanas805 and others added 2 commits May 14, 2026 15:21
…_action

Wave FIX-E findings. The MCP shipped four tools wired to /api/me/*
paths that the router never registered — every call returned a generic
"instanode.dev error (404)" and the LLM had no path forward. This PR
rewires those tools to the canonical routes, plus three smaller
contract drifts:

* /api/me/resources           → GET    /api/v1/resources           (list)
* /api/me/claim               → POST   /claim   (now takes jwt + email)
* /api/me/resources/{token}   → DELETE /api/v1/resources/{token}
* /api/me/token               → POST   /api/v1/auth/api-keys       (mint)

  The list endpoint returns {ok, items, total}; client now unwraps to
  items[] so the tool can iterate naturally. The claim flow primitive
  is identity-bound — there is no "claim a token to an existing team"
  route — so claim_token's schema is now (upgrade_jwt, email), matching
  the dashboard's flow. The mint route returns a plaintext key that's
  shown exactly once; get_api_token's wording was updated to reflect
  revocation-based (not time-bound) keys. #C5

* claim_resource built https://instanode.dev/start?t=<jwt>. /start is a
  route on the API host, NOT the dashboard host — the dashboard
  domain's path is /claim. /start is what issues the 302 to /claim.
  Now builds api.instanode.dev/start?t=<jwt>; configurable via
  INSTANODE_API_URL same as every other request. #C6

* MCP discarded `agent_action` from API error envelopes. The API
  copy-edits these sentences specifically for the LLM to read aloud
  ("Tell the user they've hit the hobby tier storage limit — have them
  upgrade at https://instanode.dev/pricing"). formatError now appends
  Action + Upgrade + Claim lines below the headline so the user gets
  the platform's canonical CTA instead of a generic "API error 402".
  client.ApiError carries the new agentAction + claimURL fields. #C7

* server.json + smithery.yaml declared INSTANODE_API_BASE while
  client.ts always read INSTANODE_API_URL. The registry-side name
  never took effect — users who set it via Smithery silently got the
  default base URL. Standardized on INSTANODE_API_URL (the name the
  client honors today). #C8

* Bumped 0.9.0 → 0.9.1. The previous 0.9.0 npm publish failed and
  `npx instanode-mcp@latest` 404'd; this version closes both. The npm
  publish step is documented in PUBLISHING.md and must be run manually
  (no NPM_TOKEN was available in the env where this PR was produced).
  #C4 #C106

test.sh extended: two new gates assert the claim host is the API host
and that claim_token rejects the old (token-only) shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Master shipped v0.10.0 (private + allowed_ips on create_deploy).
This branch's 0.9.1 collides on the version field; rolled to 0.10.1
so npm publish can take it cleanly. test.sh picks up master's new
#5c/#5d tests for private deploys alongside this branch's #7/#8
tests for the claim host + claim_token schema.
@mastermanas805 mastermanas805 merged commit e1bb4d2 into master May 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant